function removeDuplicates(arr) {
    if (!arr || arr.length === 0) return 0
    let left = 0
    for (let right = 1; right < arr.length; right++) {
        if (arr[right] !== arr[left]) {
            arr[++left] = arr[right]
        }
    }
    return left + 1
}

const arr1 = [1, 1, 2, 2, 3, 3]

console.log(removeDuplicates(arr1))